#!/bin/bash

# 语法检查脚本

echo "🔍 检查ArkTS语法..."

# 检查是否有语法错误
echo "检查文件语法..."

files=(
    "entry/src/main/ets/pages/Index.ets"
    "entry/src/main/ets/store/AppStore.ets"
    "entry/src/main/ets/components/TopNavigation.ets"
    "entry/src/main/ets/components/BottomNavigation.ets"
    "entry/src/main/ets/components/CommonCard.ets"
    "entry/src/main/ets/components/CreateChartDialog.ets"
    "entry/src/main/ets/components/MarkdownRenderer.ets"
    "entry/src/main/ets/pages/FortunePage.ets"
    "entry/src/main/ets/pages/ChartPage.ets"
    "entry/src/main/ets/pages/KnowledgePage.ets"
    "entry/src/main/ets/pages/KnowledgeDetailPage.ets"
    "entry/src/main/ets/pages/ProfilePage.ets"
    "entry/src/main/ets/pages/ChatPage.ets"
    "entry/src/main/ets/model/DataTypes.ets"
    "entry/src/main/ets/services/ApiService.ets"
    "entry/src/main/ets/config/ApiConfig.ets"
    "entry/src/main/ets/utils/MockDataService.ets"
)

error_count=0

for file in "${files[@]}"; do
    if [ -f "$file" ]; then
        echo "✅ $file 存在"
    else
        echo "❌ $file 不存在"
        ((error_count++))
    fi
done

if [ $error_count -eq 0 ]; then
    echo "🎉 所有文件检查通过！"
    echo ""
    echo "📋 项目结构："
    echo "├── 数据模型: DataTypes.ets"
    echo "├── 状态管理: AppStore.ets"
    echo "├── 通用组件: CommonCard.ets, TopNavigation.ets, BottomNavigation.ets"
    echo "├── 弹窗组件: CreateChartDialog.ets"
    echo "├── 页面组件: Index.ets, FortunePage.ets, ChartPage.ets, KnowledgePage.ets, ProfilePage.ets, ChatPage.ets"
    echo "├── 服务类: ApiService.ets"
    echo "├── 配置类: ApiConfig.ets"
    echo "└── 工具类: MockDataService.ets"
    echo ""
    echo "🚀 可以开始构建应用了！"
else
    echo "❌ 发现 $error_count 个问题，请检查文件"
fi